using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Drawing.Drawing2D;
using System.Reflection;
using ComponentFactory.Krypton.Toolkit;

namespace EnzymeLaborTool
{
    public partial class LoginDlg : Form
    {
        public string user
        {
            get
            {
                //if (checkBoxUseWinAuth.Checked)
                //    return null;
                //else
                    return textBoxLogin.Text;
            }
        }

        public string pass
        {
            get
            {
                //if (checkBoxUseWinAuth.Checked)
                //    return null;
                //else
                    return textBoxPasswd.Text;
            }
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            //GraphicsPath gp = new GraphicsPath();
            //gp.AddEllipse(0, 0, this.Width, this.Height);
            //this.Region = new Region(gp);
        }

        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);

            //Color c = Color.FromArgb(65, Color.Black);
            //Brush b = new SolidBrush(c);
            //e.Graphics.FillRectangle(b, 0, 0, this.Width, this.Height);
        }

        public LoginDlg()
        {
            InitializeComponent();
            DialogResult = DialogResult.Abort;
            textBoxLogin.Text = Properties.Settings.Default.Login;
           // checkBoxUseWinAuth.Checked = Properties.Settings.Default.UseWinAuth;
           // textBoxLogin.Enabled = !checkBoxUseWinAuth.Checked;
           // textBoxPasswd.Enabled = !checkBoxUseWinAuth.Checked;

            //TODO:KRYPTON
            // kryptonHeaderGroup1.ValuesSecondary.Description =   Assembly.GetExecutingAssembly().GetName().Version.ToString();
           
        }

        private void checkBoxUseWinAuth_CheckedChanged(object sender, EventArgs e)
        {
          //  textBoxLogin.Enabled = !checkBoxUseWinAuth.Checked;
          //  textBoxPasswd.Enabled = !checkBoxUseWinAuth.Checked;
        }

        private void buttonLogin_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Save();
            DialogResult = DialogResult.OK;
            this.Close();
        }

        private void LoginDlg_FormClosing(object sender, FormClosingEventArgs e)
        {

        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Abort;
            this.Close();
        }

        private void tableLayoutPanel_Move(object sender, EventArgs e)
        {
            
        }

        private void textBoxPasswd_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                buttonLogin_Click(null, null);
            }
        }
    }
}